package com.adee.util;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class Util {
    public static void print(int[] arr) {
        if (arr == null) {
            System.out.println("null");
        }
        String join = Arrays.stream(arr).mapToObj(i -> i + "").collect(Collectors.joining(" ", "[", "]"));
        System.out.println(join);
    }

    public static void print(Integer[] arr) {
        if (arr == null) {
            System.out.println("null");
        }
        String join = Arrays.stream(arr).map(i -> i + "").collect(Collectors.joining(" ", "[", "]"));
        System.out.println(join);
    }

    public static void print(String prefix, List<Integer> list) {
        if (list == null) {
            System.out.println("null");
        }
        String join = list.stream().map(i -> i + "").collect(Collectors.joining(" ", "[", "]"));
        System.out.println(prefix + ": ");
        System.out.println(join);
    }


    public static void print(int[][] arr) {
        if (arr == null) {
            System.out.println("null");
        }
        for (int[] ints : arr) {
            String join = Arrays.stream(ints).mapToObj(i -> i + "").collect(Collectors.joining(" ", "[", "]"));
            System.out.println(join);
        }

    }

}
